package com.bdqn.biz;

import com.bdqn.dao.BaseDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "utype", value = "/utype")
public class utype extends HttpServlet {

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("post 方法");
        request.setCharacterEncoding("utf-8");
        String nn=request.getParameter("nn");
        String id=request.getParameter("id");
        //调用底层basedao 修改数据库
        try {
            BaseDao.update("update newtype " +
                            "set name=? where id=?",
                    new Object[]{nn,id}
            );
            //跳转到页面上
            response.sendRedirect("/Web1/TypeList.jsp");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
